<template>
  <div class="pinglun">
    <div class="top">
      <p
        class="iconfont icon-zuojiantou"
        style="font-size: 25px"
        @click="tohome()"
      ></p>
      <p>评论</p>
      <p
        class="iconfont icon-24gf-ellipsisVertical"
        style="font-size: 25px"
      ></p>
      <p class="iconfont icon-paihangbang1" style="font-size: 25px"></p>
    </div>
    <div v-for="(item, index) in pinglun" :key="item.id" class="ping-b">
      <p class="number">{{ index + 1 }}</p>

      <p><img :src="item.user.avatarUrl" />{{ item.user.nickname }}:</p>
      <p class="ping-p">{{ item.content }}</p>
    </div>
    <div style="height: 80px"></div>
  </div>
</template>

<script>
import { loadpinglunAPI } from "../services/gedan";
export default {
  methods: {
    tohome() {
      this.$router.go(-1);
    },
  },
  data() {
    return {
      pinglun: [],
      id: this.$route.query.id,
    };
  },
  async created() {
    const respinglun = await loadpinglunAPI(this.id);
    this.pinglun = respinglun.hotComments;
    // console.log(this.pinglun);
    // console.log(this.pinglun.length);
  },
};
</script>

<style scoped>
html {
  background-image: linear-gradient(#9198e5, skyblue);
}
.number {
  padding: 10px;
}
.ping-b {
  padding: 10px;
}
ping-p {
  padding: 10px;
}
.top {
  height: 50px;
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.top p:nth-child(1) {
  color: black;
}
.top p:nth-child(2) {
  margin-left: 150px;
  color: black;
}
.top p:nth-child(3) {
  margin-left: 90px;
  color: black;
}
.top p:nth-child(4) {
  color: black;
}
</style>
